package com.training.java.core.collections.maps.post15;

import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

public class EntrySetDemo {

	public static void main(String[] args) {
		
		Map<String,String> studentAndFavFruits =new HashMap<>();
		
		studentAndFavFruits.put("Reenu", "Kiwi");
		studentAndFavFruits.put("Sushmita", "orange");
		studentAndFavFruits.put("Satya", "Banana");
		studentAndFavFruits.put("Reenu", "mango");
		studentAndFavFruits.put("Mira", "Kiwi");
		studentAndFavFruits.put("reenu", "kiwi");
		
		String favFruit= studentAndFavFruits.get("Reenu");
		System.out.println("Reenu's favorite fruit:"+ favFruit);
		
		Set<Entry<String,String>> entries=studentAndFavFruits.entrySet();
		    for(Entry<String,String>entry:entries)
		    {
		    	System.out.println("\nStudent name:" + entry.getKey());
		    	System.out.println("Favorite Fruit:" + entry.getValue());
		    	System.out.println("*************");
		    }
		

		
		


	}

}
